package wml.clipstore.storage.clips;

import java.lang.reflect.Field;
import java.util.List;

import wml.clipstore.base.Entity;
import wml.clipstore.map.MapManager;
import wml.clipstore.utils.EntityUtils;

public class RuleGenerater {
	
	/**
	 * 为clazz构建 “替换规则”，获取该类的每一个
	 * <ul>
	 * <li>Entity类型field:</li>
	 * <li>Collection类型field:</li>
	 * <ul>
	 * @param clazz
	 */
	public void buildRule(Class<Entity> clazz){
		String cname = clazz.getName();
		List<Field> fields = MapManager.getInstance().getStoredFields(clazz);
		for(Field field:fields){
			String fname = field.getName();
			if(EntityUtils.isSubClass(field.getType(),Entity.class)){
				String rule = "(defrule replace_"+cname+"_"+fname +" "+"?i<-("+cname+"("+fname +"?f))())";
			}
		}
		
	}
	
}
